<div class="breadcrumbwidget">
	<ul class="skins">
        <li><a href="default" class="skin-color default"></a></li>
        <li><a href="orange" class="skin-color orange"></a></li>
        <li>&nbsp;</li>
        <li class="fixed"><a href="" class="skin-layout fixed"></a></li>
        <li class="wide"><a href="" class="skin-layout wide"></a></li>
    </ul><!--skins-->
	<ul class="breadcrumb">
        <li><a href="<?php echo $baseurl?>">Trang chủ</a> <span class="divider">/</span></li>
        <li class="active">Danh sách đặt bàn</li>
    </ul>
</div><!--breadcrumbwidget-->
<div class="pagetitle">
	<h1>Quản lý danh sách đặt bàn</h1> <span></span>
</div>
<div class="maincontent">
    <div class="contentinner">    
    
        <?php $attr = array('class' => 'stdform','id' => 'form-list'); echo form_open('', $attr);?>

        <div id="filter" class="dataTables_length">
            <?php echo $fview->advancedSelectType($arrLabel, @$label_id ? @$label_id : -1, 'label_id', 'Chọn nhãn');?>
            <?php echo $fview->advancedSelectType($arrZone, @$zone_id ? @$zone_id : -1, 'zone_id', 'Chọn khu vực');?>
            <input id="timing" type="text" value="<?php echo @$time;?>" name="time" placeholder="Ngày đặt bàn" style="padding: 6px 5px; background-color: #fff; font-size: 12px;"/>
            <button type="submit" class="btn btn-success">Lọc</button>
        </div>
        
        </form>
        <button id="report" class="btn btn-primary" style="position: absolute; top: 28px; right: 30px;">Xuất báo cáo</button>
        
    	<table class="table table-bordered">
            <colgroup>
                <col class="con0" />
                <col class="con1" />
                <col class="con0" />
                <col class="con1" />
                <col class="con0" />
                <col class="con1" />
            </colgroup>
            <thead>
                <tr>
                	<!--th class="centeralign" style="width: 5%;"><input type="checkbox" class="checkall" /></th-->
                    <th>STT</th>
                    <th>Tên nhà hàng - địa chỉ</th>
					<th>Họ tên</th>
                    <th>Số điện thoại</th>
                   <th>Thời gian đặt</th>
				   <th>Phê duyệt</th>
                    <th class="centeralign" style="width: 10%">Tác vụ</th>
                </tr>
            </thead>
            <tbody>

            <?php if(!in_array($data, array(null, '', '0'))):?>
            <?php
                $i = 1;
             foreach($data['data'] AS $el=>$le):
            ?>
                <tr>
                	<!--td class="centeralign"><input name="checkboxs[]" id="<?php echo $le->rid?>" type="checkbox" value="<?php echo $le->rid?>" /></td-->
                    <td><?php echo $pageg*$per_page + $i;?></td>
                   <td>
                       <?php echo $le->name_res ? $le->name_res.'<br/><i style="font-size:12px;">'.$le->res_address.'</i>' : 'Đang cập nhật';?>
                    </td>
                   <td><?php echo $le->name ? $le->name : 'Đang cập nhật';?></td>
                    <td><?php echo $le->phone ? $le->phone : 'Đang cập nhật';?></td>
					 <td><?php echo $le->time_booking != '|' ? str_replace('|', ' ', str_replace(':', 'h', $le->time_booking)) : 'Đang cập nhật';?></td>
					 
					 <td>
                       <?php if( $le->improved == 1 ){ echo "<center><span class='icon-ok'></span></center>"; }  ?>
                    </td>
					
                  
                    <td class="centeralign">
                        <a style="margin-right: 10px;" href="<?php echo $baseurl.'manage/booking/edit-booking/'.$le->bid?>" class=""><span class="icon-edit"></span></a>
                        <a href="<?php echo $baseurl.'manage/booking/delete-booking/'.$le->bid?>" class="delete-a"><span class="icon-trash"></span></a>   
                    </td>
                </tr>
            <?php $i++; endforeach;?>
            <?php endif?>
			
			
            </tbody>
        </table>
        <div class="dataTables_info" id="dyntable_info">
            <div class="pagination">
                <?php echo $this->pagination->create_links();?> 
            </div>
        </div>
    </div>
</div>

<div id="hideReport" style="display: none;"></div>
<style>
#filter > * {
    vertical-align: middle !important;
}
</style>
<script type="text/javascript">
    if(jQuery('#timing').length > 0)
		jQuery( "#timing" ).datepicker({
		  "dateFormat": 'dd/mm/yy'
		});
        
    $(document).ready(function(){
        $('#report').on('click', function(){
            $.ajax({
               type: "GET",
               url: baseUrl+'manage/booking/report/<?php echo $thisParam;?>',
               beforeSend: function(){
                    showPreload();
               },
               success: function(n){
                    $('#hideReport').html(n);
                    exportToExcel();
               }  
            });
        });
    });
</script>